package Vue;

import org.openstreetmap.gui.jmapviewer.JMapViewer;
import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;

import Controleur.LoadSource;
import Controleur.Map_event;

/**
 * Définit la carte
 */
public class Map extends JMapViewer {

	
	private static final long serialVersionUID = 1L;

	/**
	 * Instancie la map
	 */
	public Map() {

		refreshStations();
		this.setDisplayToFitMapMarkers();
		for(int i = 0; i < 7; i++){
			this.zoomIn();
		}

		addMouseListener(new Map_event(this));

	}

	/**
	 * Rafraichit les stations sur la carte
	 */
	public void refreshStations() {
		
		removeAllMapMarkers();
		for (MapMarker marker : LoadSource.getMapMarkerStations()) {
			this.addMapMarker(marker);
		}
		
	}

}